﻿<?xml version="1.0" encoding="utf-8"?>
<package name="PokemonBattle.BattleRoom">
    <references>
        <assembly name="PokemonBattle.BattleNetwork"/>
    </references>
    <registenum name="BattleMode" />
    <datastructures>
        <enum name="UserState">
            <element name="Free"/>
            <element name="Challenging" />
            <element name="Battling" />
            <element name="Away" />
        </enum>
        <enum name="BattleLinkMode">
            <element name="Direct"/>
            <element name="Agent" />
        </enum>
        <struct name="User">
            <field name="Identity" type="int" />
            <field name="Name" type="string"/>
            <field name="State" type="UserState" />
            <field name="Address" type="string" />
            <field name="ImageKey" type="byte" />
            <field name="CustomDataInfo" type="string" />
            <field name="CustomDataHash" type="string" />
        </struct>
        <struct name="ChallengeInfo">
            <field name="BattleMode" type="BattleMode" />
            <field name="LinkMode" type="BattleLinkMode" />
            <field name="Rules" type="BattleRuleSequence" />
        </struct>
        <struct name="ObserveInfo">
            <field name="BattleAddress" type="string" />
            <field name="BattleIdentity" type="int" />
            <field name="Position" type="byte" />
        </struct>
        <struct name="FourPlayerRoom">
            <field name="Name" type="string"/>
            <field name="Identity" type="int"/>
            <field name="PlayerCount" type="byte"/>
        </struct>
        <struct name="RoomBattleSetting">
            <field name="MoveInterval" type="int"/>
            <field name="SingleBan" type="bool"/>
            <field name="DoubleBan" type="bool"/>
            <field name="FourPlayerBan" type="bool"/>
            <field name="RandomOnly" type="bool"/>
            <field name="Version" type="string"/>
        </struct>
        
        <sequence name="UserSequence" element="User"/>
        <sequence name="FourPlayerRoomSequence"  element="FourPlayerRoom"/>
    </datastructures>
    <service name="Room">
        <server>
            <!-- Challenge -->
            <transaction name="AcceptChallenge">
                <param name="targetIdentity" type="int"/>
            </transaction>
            <transaction name="RefuseChallenge">
                <param name="targetIdentity" type="int" />
            </transaction>
            <transaction name="Challenge">
                <param name="targetIdentity" type="int" />
                <param name="info" type="ChallengeInfo" />
            </transaction>
            <transaction name="CancelChallenge">
                <param name="targetIdentity" type="int" />
            </transaction>
            
            <!-- Battle -->
            <transaction name="StartBattle">
                <param name="with" type="int"/>
                <param name="info" type="ChallengeInfo" />
            </transaction>
            <transaction name="StartFourPlayerBattle">
                <param name="battleIdentity" type="int"/>
                <param name="position" type="byte"/>
            </transaction>
            <transaction name="GetObserveInfo">
                <param name="identity" type="int"/>
            </transaction>

            <!-- User -->
            <transaction name="UserLogon">
                <param name="info" type="User" />
            </transaction>
            <transaction name="UserLogout" />
            <transaction name="UpdateUser">
                <param name="info" type="User" />
            </transaction>

            <!-- Message -->
            <transaction name="ReceiveBroadcastMessage">
                <param name="message" type="string" />
            </transaction>
            <transaction name="ReceiveChatMessage">
                <param name="to" type="int"/>
                <param name="message" type="string" />
            </transaction>
            <transaction name="ReceiveRoomCommand">
                <param name="message" type="string"/>
            </transaction>
            
            <!-- 4P -->
            <transaction name="RegistFourPlayer"/>
        </server>
        <client>
            <!-- Challenge -->
            <transaction name="AcceptChallenge">
                <param name="from" type="int"/>
            </transaction>
            <transaction name="RefuseChallenge">
                <param name="from" type="int" />
            </transaction>
            <transaction name="Challenge">
                <param name="from" type="int" />
                <param name="info" type="ChallengeInfo" />
            </transaction>
            <transaction name="CancelChallenge">
                <param name="from" type="int" />
            </transaction>
            
            <!-- Battle -->
            <transaction name="DirectBattle">
                <param name="server" type="int"/>
                <param name="battleMode" type="BattleMode"/>
            </transaction>
            <transaction name="AgentBattle">
                <param name="identity" type="int"/>
                <param name="playerPosition" type="byte" />
                <param name="battleMode" type="BattleMode"/>
            </transaction>
            <transaction name="ReceiveObserveInfo">
                <param name="info" type="ObserveInfo"/>
            </transaction>

            <!-- Message -->
            <transaction name="ReceiveBroadcastMessage">
                <param name="message" type="string"/>
            </transaction>
            <transaction name="ReceiveChatMessage">
                <param name="from" type="int"/>
                <param name="message" type="string" />
            </transaction>

            <!-- User -->
            <transaction name="LogonSuccess">
                <param name="info" type="User" />
            </transaction>
            <transaction name="LogonFail">
                <param name="message" type="string"/>
            </transaction>
            <transaction name="BeKicked" />

            <transaction name="UpdateUser">
                <param name="userInfo" type="User" />
            </transaction>
            <transaction name="AddNewUser">
                <param name="userInfo" type="User" />
            </transaction>
            <transaction name="RemoveUser">
                <param name="identity" type="int" />
            </transaction>
            <transaction name="AddUserList">
                <param name="users" type="UserSequence"/>
            </transaction>
            <transaction name="UpdateRoomSetting">
                <param name="setting" type="RoomBattleSetting"/>
            </transaction>

            <!-- 4P -->
            <transaction name="RegistFourPlayerSuccess">
                <param name="identity" type="int"/>
            </transaction>
            <transaction name="AddFourPlayerRoomList">
                <param name="rooms" type="FourPlayerRoomSequence"/>
            </transaction>
            <transaction name="AddFourPlayerRoom">
                <param name="identity" type="int"/>
                <param name="host" type="string"/>
            </transaction>
            <transaction name="RemoveFourPlayerRoom">
                <param name="identity" type="int"/>
            </transaction>
            <transaction name="UpdateFourPlayerRoom">
                <param name="identity" type="int"/>
                <param name="userCount" type="byte"/>
            </transaction>
        </client>
    </service>
</package>
